﻿
#pragma once

#include <angelscript.h>
#include "..\3rdLib\ASadd_on\scriptstring.h"


BEGIN_AS_NAMESPACE
///wstring的wrapper类，脚本用
class CScriptWString
{
public:
	CScriptWString();
	CScriptWString(const CScriptWString &other);
	CScriptWString(const CScriptString &other);
	CScriptWString(const TCHAR *s);
	CScriptWString(const std::wstring &s);

	void AddRef();
	void Release();

	CScriptWString &operator=(const CScriptWString &other);
	CScriptWString &operator+=(const CScriptWString &other);
	friend CScriptWString *operator+(const CScriptWString &a, const CScriptWString &b);

	///将string类型转换为wstring
	CScriptWString &operator=(const CScriptString& s);
	int opCmp(const CScriptWString& other);

	std::wstring buffer;

public:
	~CScriptWString();
	int refCount;
};

void RegisterScriptWString(asIScriptEngine *engine);

void RegisterScriptWString_Native(asIScriptEngine *engine);

END_AS_NAMESPACE

